<html>
<head><title>My Test Extension Options</title></head>
<script type="text/javascript">

// Saves options to localStorage.
function save_options() {
  var select = document.getElementById("filteraddr");
  var filteraddress = select.value;
  localStorage["filteraddr"] = filteraddress;

  // Update status to let user know options were saved.
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
}

// Restores select box state to saved value from localStorage.
function restore_options() {
  var faddr = localStorage["filteraddr"];
  if (!faddr) {
    faddr = "mail.google.com";
  }
  var select = document.getElementById("filteraddr");
  select.value = faddr;
}

</script>

<body onload="restore_options()">

Filter address: <input type="text" id="filteraddr" />

<button onclick="save_options()">Save</button>
<span id="status"></span>
</body>
</html>
